import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';

// 查询行业列表
export class FindWelfareDto {
  @ApiProperty({ default: 1, description: '当前页' })
  @Type(() => Number)
  @IsNumber()
  page: number = 1;

  @ApiProperty({ default: 10, description: '查询条数' })
  @Type(() => Number)
  @IsNumber()
  size: number = 10;

  @ApiPropertyOptional({ description: '名称' })
  @IsOptional()
  @IsString()
  name?: string;

  @ApiPropertyOptional({ description: '状态' })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  enableStatus?: number;
}

export class CreateWelfareDto {
  @ApiProperty({ description: '福利名称' })
  @IsString()
  @IsNotEmpty()
  name: string;

  @ApiPropertyOptional({ default: 1, description: '排序' })
  @IsNumber()
  @IsNotEmpty()
  order: number;

  @ApiPropertyOptional({ default: 1, description: '状态' })
  @IsNumber()
  @IsNotEmpty()
  enableStatus: number;
}

export class UpdateWelfareDto extends CreateWelfareDto {
  @ApiProperty({ description: 'ID' })
  @IsNumber()
  @IsNotEmpty()
  id: number;
}
